<template>
  <a-form-model layout="horizontal" ref="ruleForm" :rules="rules" :model="model" v-bind="formItemLayout">
    <z-form-item :rules="rules" :datas="fieldArr" :form="model" :gutter="0">
      <!--//自定义住所方位图-->
      <template slot="slots-livePositionMap">
        <j-image-upload bizPath="scott/pic" v-model="model.livePositionMap" />
      </template>
      <!--//自定义居住地房屋照片-->
      <template slot="slots-liveHouseMap">
        <j-image-upload bizPath="scott/pic" v-model="model.liveHouseMap" />
      </template>
    </z-form-item>
  </a-form-model>
</template>

<script>
export default {
  props: ['current', 'controlPersonType', 'value'],
  data() {
    return {
      formItemLayout: {
        labelCol: { span: 6 },
        wrapperCol: { span: 13 },
      },
      model: {},
      fieldArr: [//currentAddress
        {label: '居住地详址', prop: 'liveAddress', tagType: 'input', disabled: true},
        {label: '住所方位图', prop: 'livePositionMap'},
        {label: '居住地房屋照片', prop: 'liveHouseMap'},
        {label: '备注', prop: 'remark', tagType: 'textarea'},
        {label: '工作单位', prop: 'workUnit', tagType: 'input',disabled: true},
        {label: '单位坐标', prop: 'unitCoordinate', tagType: 'input', disabled: false},
      ],
      rules: {
        livePositionMap: [
          { required: true, message: '请上传', trigger: 'change' },
        ],
        liveHouseMap: [
          { required: true, message: '请上传', trigger: 'change' },
        ],
        unitCoordinate: [
          { required: true, message: '请输入', trigger: 'change' },
        ],
      },
    }
  },
  computed: {
    getValue() {
      let value = this.value ? this.value : {}
      return value
    }
  },
  watch: {
    getValue: {
      immediate: true,
      deep: true,
      handler(val) {
        // console.log(val)
        this.model = Object.assign({}, this.model, val)
      }
    },
    // model:{
    //   immediate: true,
    //   deep: true,
    //   handler(val) {
    //     this.$emit('change', this.current, val)
    //   }
    // }
  },
  methods: {}
}
</script>

<style scoped lang="less"></style>
